<?php

declare(strict_types=1);

namespace So\Controller;

use Hyperf\Di\Annotation\Inject;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use So\Request;
use So\Response;
use So\Cache;
use So\Controller;

/**
 * Backend后端基类
 * @author Saopig <1306222220@qq.com>
 */
class Backend extends Controller
{
    use \So\Trait\Backend;

    /**
     * @Inject
     * @var Cache
     */
    protected $cache;

    /**
     * 是否为开发环境
     * @var isDev
     */
    protected $isDev;

    /**
     * 高级搜索分隔符
     * @var searchBreak
     */
    protected $searchBreak = '|||||';

    public function __construct()
    {
        $this->isDev = config("app_env") == "dev";
    }

    /**
     * @param string|int $msg
     * @param array $data
     * @return ResponseInterface
     */
    protected function success(string|int $msg = '', mixed $data = []): ResponseInterface
    {
        return $this->response->success($msg, $data);
    }

    /**
     * @param string $msg
     * @return ResponseInterface
     */
    protected function error(string $msg = ''): ResponseInterface
    {
        return $this->response->error($msg);
    }


}
